from contextlib import contextmanager


@contextmanager
def my_context():
    print("Entering the context")
    yield "some value"  # yield 的值会赋给 as 后面的变量
    print("Exiting the context")


with my_context() as value:
    print(f"Inside context, got: {value}")
